﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PerCiGal.WebInfo.Movie;
using PerCiGal.WebInfo.Movie.themoviedb.org;

namespace PerCiGal.TestForm
{
    public partial class WebMovieInfoForm : Form
    {
        public WebMovieInfoForm()
        {
            InitializeComponent();
        }

        private void button_GetMovieList_Click(object sender, EventArgs e)
        {
            listView1.Items.Clear();

            Engine _themoviedb = new Engine();

            Types.MOVIE_WEBLIST movieWeblist = _themoviedb.GetMovieList(textBox_Search.Text, Types.Language.IT);

            foreach (var movie in movieWeblist.Items)
            {
                ListViewItem newItem = listView1.Items.Add("");
                newItem.SubItems.Add(movie.COD_MOVIE);
                newItem.SubItems.Add(movie.MAIN_TITLE);
                newItem.SubItems.Add(movie.RELEASE_YEAR.ToString());
            }
        }

        private void buttonGetMovie_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                string id = listView1.SelectedItems[0].SubItems[1].Text;

                Engine _themoviedb = new Engine();

                Types.MOVIE_WEBDETAILS movieDetails = _themoviedb.GetMovieDetails(id, Types.Language.IT);
            }
        }

    }
}
